<include file="Public:header" />
<script type="text/javascript">
    //获取选择ID
    function getItem() {
        var selectRow = Array();
        var obj = document.getElementsByName('dataArray');
        var result = '';
        var j = 0;
        for (var i = 0; i < obj.length; i++) {
            if (obj[i].checked == true) {
                selectRow[j] = i + 1;
                result += obj[i].value + ",";
                j++;
            }
        }
        return result.substring(0, result.length - 1);
    }

    function doCache() {
        var itemValue = getItem();
        if (itemValue == '') {
            alert('没有选择需要更新的缓存类型');
            return false;
        }
        $.ajax({
            type: "POST",
            url: '{:U("Tools/doCache")}',
            data: {
                dataArr: itemValue
            },
            beforeSend: function() {
                $("#cache").html('<span style="color:#FF0000"><img src="__PUBLIC__/Admin/loading.gif" align="absmiddle">正在执行...</span>');
            },
            success: function(data) {
                switch (data) {
                case 'errorVerifyCode':
                    break
                default:
                    $("#cache").html(data);
                    $('#cache').show();
                    //alert ('未知错误，请联系管理员');
                }

            }
        });
    }
</script>
<div class="mainarea">
<div class="maininner">
	
	<div class="body_content">
	
	<div class="title">
		<h3>更新缓存</h3>
	</div>

	<form action="{:U('Tools/cache')}" method="post" id="updateCache">
<table id="maintable" class="formtable">
	<tr>
		<th style="width:5em;"></th>
		<td><span style="float:left; width:25%;"><input name="dataArray" type="checkbox" id="config" value="config" class="checkbox" />系统配置</span>
        <span style="float:left; width:25%;"><input name="dataArray" type="checkbox" id="role" value="role" class="checkbox" />角色</span>
        <span style="float:left; width:25%;"><input name="dataArray" type="checkbox" id="category" value="category" class="checkbox" />分类</span>
        <span style="float:left; width:25%;"><input name="dataArray" type="checkbox" id="s" value="menu" class="checkbox" />导航</span>
        <span style="float:left; width:25%;"><input name="dataArray" type="checkbox" id="link" value="link" class="checkbox" />链接</span>
        <span style="float:left; width:25%;"><input name="dataArray" type="checkbox" id="tags" value="tags" class="checkbox" />Tags</span>
        <span style="float:left; width:25%;"><input name="dataArray" type="checkbox" id="ad" value="ad" class="checkbox" />广告</span>
        <span style="float:left; width:25%;"><input name="dataArray" type="checkbox" id="module" value="module" class="checkbox" />模块</span>
        <span style="float:left; width:25%;"><input name="dataArray" type="checkbox" id="module" value="core" class="checkbox" />核心</span>
        </td>
	</tr>
	<tr>
	  <th>&nbsp;</th>
	  <td><input type="checkbox" id="chkall" name="chkall" onclick="checkAll(this.form, 'dataArray')">全选</td>
	  </tr>
	<tr>
		<th>&nbsp;</th>
		<th>
			<input type="button" name="submit" value="提交更新" class="submit" id="submit" onclick="doCache()">
        <input type="reset" name="button" id="button" value="还原重选" class="submit"/>
		</th>
	</tr>
	<tr>
	  <th>&nbsp;</th>
	  <td><div id="cache"></div></td>
	  </tr>
	
	</table>
</form>
    
<br />
	<div class="title" id="register">
			<h3>重新统计Tags计数</h3>
	</div>
	<form action="{:U('Tools/countTags')}" method="get" id="updateCache">
<table id="maintable" class="formtable">
	
	<tr>
	  <th style="width:5em;">&nbsp;</th>
	  <td><select name="module" id="module">
	    <option value="News" selected="selected">新闻</option>
	    <option value="Product">产品</option>
	    <option value="Download">下载</option>
	    <option value="Job">人才</option>
	  </select></td>
	  </tr>
	<tr>
	  <th style="width:5em;">&nbsp;</th>
	  <td><label>
	      <input name="pageSize" type="text" id="pageSize" value="50" size="6" />
	      每次更新数量，Tags数量非常之时越小越好，防止程序执行时间超时</label></td>
	  </tr>
	<tr>
	  <th style="width:5em;">&nbsp;</th>
	  <td>此功能能将重新统计Tags数量</td>
	  </tr>
	<tr>
	  <th>&nbsp;</th>
	  <th>
	    <input type="submit" name="submit" value="提交更新" class="submit" id="submit">
	    </th>
	  </tr>
	
	</table>
</form>
	<br />
	
	</div>
</div>
</div>

<div class="side">
	<include file="Public:sider" />
</div>

<include file="Public:footer" />